Skip to content

feat: Allowing for more user provided events in PromptField for analytics tracking - #10479

Open
LFDanLu wants to merge 3 commits into
mainfrom
8-18_coworker_followups
Open

feat: Allowing for more user provided events in PromptField for analytics tracking#10479
LFDanLu wants to merge 3 commits into
mainfrom
8-18_coworker_followups

Conversation

@LFDanLu

@LFDanLu LFDanLu commented Aug 18, 2026

Copy link
Copy Markdown
Member

Adds callbacks so users can track when things like the AI terms link, InsertMenuButton, and AttachmentMenuItem are triggered for analytics

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices
  • I understand every change in this PR and can explain why it's there.
  • If AI-assisted, I followed our AI contribution guidance and pointed my assistant at CLAUDE.md.

📝 Test Instructions:

Tests should cover the changes

🧢 Your Project:

RSP

@LFDanLu
LFDanLu force-pushed the 8-18_coworker_followups branch from e7dfc48 to 338cf32 Compare August 18, 2026 22:45
@rspbot

rspbot commented Aug 18, 2026

Copy link
Copy Markdown

@rspbot

rspbot commented Aug 18, 2026

Copy link
Copy Markdown

@LFDanLu
LFDanLu marked this pull request as ready for review August 26, 2026 17:10
@LFDanLu LFDanLu changed the title feat: (WIP) Allowing for more user provided events in PromptField for analytics tracking feat: Allowing for more user provided events in PromptField for analytics tracking Aug 26, 2026
@rspbot

rspbot commented Aug 26, 2026

Copy link
Copy Markdown

@rspbot

rspbot commented Aug 26, 2026

Copy link
Copy Markdown

@rspbot

rspbot commented Aug 26, 2026

Copy link
Copy Markdown
## API Changes

@react-spectrum/ai

/@react-spectrum/ai:PromptField

 PromptField {
   acceptedAttachmentTypes?: Array<string>
   attachments?: Array<PromptFieldAttachment>
   brandColor?: string
   children: React.ReactNode
   defaultAttachments?: Array<PromptFieldAttachment>
   defaultValue?: PromptFieldValue
   isGenerating?: boolean
+  onAITermsPress?: () => void
   onAddAttachments?: (Array<PromptFieldAttachment>) => void
   onAttachmentsChange?: (Array<PromptFieldAttachment>) => void
   onChange?: (PromptFieldValue) => void
   onRemoveAttachments?: (Array<PromptFieldAttachment>) => void
   onSubmit?: (TokenFieldValue, Array<PromptFieldAttachment>) => void
   styles?: StyleString
   value?: PromptFieldValue
   variant?: 'balanced' | 'prominent' | 'subtle'
 }

/@react-spectrum/ai:AttachFileMenuItem

 AttachFileMenuItem {
-
+  aria-label?: string
+  id?: Key
+  isDisabled?: boolean
+  onAction?: () => void
+  onBlur?: (FocusEvent<Target>) => void
+  onFocus?: (FocusEvent<Target>) => void
+  onFocusChange?: (boolean) => void
+  onHoverChange?: (boolean) => void
+  onHoverEnd?: (HoverEvent) => void
+  onHoverStart?: (HoverEvent) => void
+  onPress?: (PressEvent) => void
+  onPressChange?: (boolean) => void
+  onPressEnd?: (PressEvent) => void
+  onPressStart?: (PressEvent) => void
+  onPressUp?: (PressEvent) => void
+  shouldCloseOnSelect?: boolean
+  styles?: StylesProp
+  textValue?: string
+  value?: T
 }

/@react-spectrum/ai:InsertMenuButton

 InsertMenuButton {
   children: React.ReactNode
+  onOpenChange?: (boolean) => void
 }

/@react-spectrum/ai:PromptFieldProps

 PromptFieldProps {
   acceptedAttachmentTypes?: Array<string>
   attachments?: Array<PromptFieldAttachment>
   brandColor?: string
   children: React.ReactNode
   defaultAttachments?: Array<PromptFieldAttachment>
   defaultValue?: PromptFieldValue
   isGenerating?: boolean
+  onAITermsPress?: () => void
   onAddAttachments?: (Array<PromptFieldAttachment>) => void
   onAttachmentsChange?: (Array<PromptFieldAttachment>) => void
   onChange?: (PromptFieldValue) => void
   onRemoveAttachments?: (Array<PromptFieldAttachment>) => void
   onSubmit?: (TokenFieldValue, Array<PromptFieldAttachment>) => void
   styles?: StyleString
   value?: PromptFieldValue
   variant?: 'balanced' | 'prominent' | 'subtle'
 }

/@react-spectrum/ai:InsertMenuItemProps

 InsertMenuItemProps {
   children: React.ReactNode
+  onOpenChange?: (boolean) => void
 }

/@react-spectrum/ai:AttachFileMenuItemProps

+AttachFileMenuItemProps {
+  aria-label?: string
+  id?: Key
+  isDisabled?: boolean
+  onAction?: () => void
+  onBlur?: (FocusEvent<Target>) => void
+  onFocus?: (FocusEvent<Target>) => void
+  onFocusChange?: (boolean) => void
+  onHoverChange?: (boolean) => void
+  onHoverEnd?: (HoverEvent) => void
+  onHoverStart?: (HoverEvent) => void
+  onPress?: (PressEvent) => void
+  onPressChange?: (boolean) => void
+  onPressEnd?: (PressEvent) => void
+  onPressStart?: (PressEvent) => void
+  onPressUp?: (PressEvent) => void
+  shouldCloseOnSelect?: boolean
+  styles?: StylesProp
+  textValue?: string
+  value?: T
+}

@rspbot

rspbot commented Aug 26, 2026

Copy link
Copy Markdown

Agent Skills Changes

Modified (8)
Install

React Spectrum S2:

npx skills add https://d1pzu54gtk2aed.cloudfront.net/pr/b62a58635fc7212ba17f7a9cd07890056e311585/

React Aria:

npx skills add https://d5iwopk28bdhl.cloudfront.net/pr/b62a58635fc7212ba17f7a9cd07890056e311585/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants